#include<iostream>
#include<string>
#include<sstream>
#include<vector>

using namespace std;

//输入整形数组 输出子数组之和最大值
//当前位置之前的数组和小于0,则当前令现在的数组和最大值为当前值
long long maxSum(vector<int>& vec);

int main(){
        //输入int数组 以空格隔开
	string str;
	while(1){
		getline(cin,str);
		if(str == "quit")
			return 0;
		stringstream ss;
		ss << str;

		vector<int> vec;
		int tmp;

		while(ss >> tmp){
			vec.emplace_back(tmp);
		}

		cout << maxSum(vec) << endl;
	}
	return 0;
}


long long maxSum(vector<int>& vec){
	int size = vec.size();
	if(size == 0) return 0;

	long long max = vec[0], cur = max;

	for(int i = 1; i < size; i ++){
		if(cur < 0) cur = 0;
		cur += vec[i];
		if(cur > max) max = cur;
	}

	return max;
}
			
